#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;
class animal{

public:
    int num;
    animal(int num){
        this->num=num;

    }
    animal(animal &a){
        memcpy(this,&a, sizeof(animal));        //拷贝对象到this
        printf("exection copy\n");

    }
    int output(){
        return num;

    }
    ~animal(){
        printf("析构函数\n");

    }









};






int main() {
    animal a(9);
    animal b=a;     //栈内拷贝
    animal *c=new animal(a);        //堆内拷贝
    printf("num=%d\n",b.output());
    printf("num=%d\n",c->output());





    return 0;
}